package com.one.rope.mvp.web.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author Weijian.liu
 * @desc 属性配置
 * @date 2020/02/19
 */
@EnableConfigurationProperties
@PropertySource("classpath:${spring.profiles.active}/config.properties")
@ConfigurationProperties(prefix = "config")
@Component
@Data
public class CommonConfig {

  /**********开关配置****************/
  @Value("${enableSendSms}")
  private int enableSendSms;

  /**********Redis****************/
  @Value("${redis.host}")
  private String host;

  @Value("${redis.port}")
  private int port;

  @Value("${redis.pool.password}")
  private String password;

  @Value("${redis.maxTotal}")
  private int maxTotal;

  @Value("${redis.maxIdle}")
  private int maxIdle;

  @Value("${redis.maxWait}")
  private int maxWait;

  @Value("${redis.timeout}")
  private int timeout;

  @Value("${redis.testOnBorrow}")
  private boolean testOnBorrow;


  /**********WX****************/
  @Value("${wx.miniprogram.appId}")
  private String wxMiniProgramAppId;

  @Value("${wx.miniprogram.appSecret}")
  private String wxMiniProgramAppSecret;

  @Value("${wx.miniprogram.code2Session.url}")
  private String wxMiniProgramCode2SessionUrl;

  @Value("${wx.miniprogram.skip.appId}")
  private String wxMiniProgramSkipAppId;

  @Value("${wx.miniprogram.skip.bIndexPath}")
  private String wxMiniProgramSkipBIndexPath;

  @Value("${wx.miniprogram.skip.cIndexPath}")
  private String wxMiniProgramSkipCIndexPath;

  @Value("${wx.official.appId}")
  private String wxOfficialAppId;

  @Value("${wx.official.appSecret}")
  private String wxOfficialAppSecret;

  @Value("${wx.server.token}")
  private String wxServerToken;

  @Value("${wx.server.encodingAesKey}")
  private String wxServerEncodingAesKey;

  @Value("${wx.official.templateMsgId}")
  private String wxOfficialTemplateMsgId;


  /**********Aliyun****************/
  @Value("${aliyun.accessKeyID}")
  private String aliyunAccessKeyID;

  @Value("${aliyun.accessKeySecret}")
  private String aliyunAccessKeySecret;

  @Value("${aliyun.sms.verifyCodeTemplate}")
  private String verifyCodeTemplate;
}
